package com.lan3g.Test.controller;

import com.lan3g.Test.Model.LoginModel;
import com.lan3g.Test.pojo.User;
import com.lan3g.Test.util.JDBCUtil;

public class LoginController {
    private LoginModel loginModel= new LoginModel();
    public User login(String username,String password){
        try {
            if (username==null||password==null){
                return null;
            }
            if (!loginModel.canLogin(username,password)){
                return null;
            }
            User user =loginModel.login(username,password);
            return user;
        }finally {
            JDBCUtil.closeConn();
        }
    }
}
